home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / INTERRUP.SWG / 0018_Screen Blanker-Interrupts.pas < prev    next >
Pascal/Delphi Source File  |  1994-05-26  |  3KB  |  125 lines

  1. {
  2. Via SLMAIL v3.5C  (#2081)
  3.  -=> Quoting Joe Irwin to Maynard Philbrook <=-
  4.  JI> either inline code or assembler that could be compiled to obj and
  5.  JI> linked that would read the keyboard and if a key is not pressed in a
  6.  JI> variable or set amount of time jump to a procedure.  I'm talking about
  7.  JI> a tsr routine and what I have in mind is a tsr dos screensaver.  I've
  8.  JI> been working on this forever and am just not good enough with interupts
  9.  JI> or assembler to do it. I'm using tp 5.5 which does not support the asm
  10.  JI> command but inline(/) only.  Any help would be appreciated.
  11.  JI> Joe Irwin
  12.  JI> -!- FMail 0.92
  13.  JI>  ! Origin: MK Tech BBS-MK Software (513)237-7737 Dayton,OH HST/v32
  14.  JI> (1:110/290)
  15. }
  16.  
  17. Uses dos,crt;
  18.  
  19. Const Set_Time :Word = 100;      { 0 for no blanking }
  20. Var
  21. Temp,Temp1 : Integer;
  22. C :Char;
  23. Old_Screen :Array[0..1999] of Word;
  24. OLD_INT9, OLD_INT8 :Pointer;
  25. NO_Pressed :Word;      { Counter }
  26. Saved_Flag :Word;       { varifie Flag }
  27.  
  28. {$F+}
  29. Procedure New_Int9; Assembler;     { all of this could be done in TASM }
  30. asm     Push   ES;
  31.        Push    DS;
  32.         Push   BX;
  33.         Push   AX;
  34.         Mov    AX, Seg NO_Pressed;
  35.         Mov    DS, AX;
  36.         Mov    AX, Set_TIme;
  37.         Mov    NO_Pressed, AX;
  38.         Mov    AX, Word [Old_INT9];
  39.         Mov     Word ptr CS:@Return, AX;
  40.         Mov    AX, Word [OLD_INT9+2];
  41.         Mov    Word ptr CS:@Return+2, AX;
  42.         Cmp    Word Ptr Saved_Flag, 00;
  43.         Je     @Done;
  44.        Mov     Word ptr Saved_Flag, 00;
  45.         Mov    BX, 3999;
  46.         Mov    AX, $B800;
  47.         Mov    ES, AX;
  48. @loop:
  49.        Mov     AL, byte [OLD_SCREEN+BX];
  50.        Mov     [ES:BX], AL;
  51.         Dec    BX;
  52.         Jnz    @Loop;
  53.         Mov    AL, byte [OLD_SCREEN+BX];
  54.         Mov    [ES:BX], AL;
  55. @Done:
  56.         Pop    AX;
  57.         Pop    BX;
  58.         Pop    DS;
  59.         Pop    ES;
  60.         Jmp  [Dword(@Return)];
  61. @Return:
  62.        DD      0;
  63. End;
  64.  
  65. Procedure New_Int8; Assembler;
  66. ASm
  67.        Push    ES;
  68.        Push    DS;
  69.         Push    BX;
  70.         Push    AX;
  71.         Mov    AX, Seg NO_Pressed;
  72.         Mov    DS, AX;
  73.         Mov    AX, Word [Old_INT8];
  74.         Mov     Word ptr @Return, AX;
  75.         Mov    AX, Word [OLD_INT8+2];
  76.         Mov    Word ptr @Return+2, AX;
  77.         Cmp    NO_PRESSED, $00;
  78.         Je     @Done;
  79.         Dec    Word Ptr NO_PRESSED;
  80.         Jnz    @Done;
  81.         Mov    Saved_Flag, $01;
  82.        Mov     AX, $B800;
  83.         Mov    ES, AX;
  84.        Mov     BX, 3999;
  85. @loop:
  86.        Mov     AL, byte ptr [ES:BX];
  87.        Mov     byte  ptr OLD_SCREEN+BX, AL;
  88.         Mov    byte [ES:BX], 0 ;
  89.         Dec    BX;
  90.         Jnz    @Loop;
  91.         Mov    AL, byte ptr [ES:BX];
  92.         Mov    byte ptr OLD_SCREEN+BX, AL;
  93. @DONE:
  94.         Pop    AX;
  95.         Pop    BX;
  96.         Pop    DS;
  97.         Pop    ES;
  98.         Jmp    [Dword(@Return)];
  99. @Return:
  100.        DD      0;
  101. End;
  102.  
  103. BEGIN
  104.  
  105.    Val(Paramstr(1), Temp, Temp1);
  106.    If Temp1 = 0 Then Set_Time := temp*18;
  107.    NO_PRESSED := Set_Time;
  108.    SAVED_FLAG := 00;
  109.    GetIntVec($08, OLD_INT8);
  110.    GetIntVec($09, OLD_INT9);
  111.    SetIntVec($09, @New_Int9);
  112.    SetIntVec($08, @New_Int8);
  113.  
  114.  
  115.    While NOT Keypressed DO;
  116.    { process  your program here }
  117.  
  118. SetIntVec($08, old_int8);      { to restore it back to normal }
  119. SetIntVec($09, old_int9);
  120. CLrScr;
  121. WriteLn(' Program Writen Bye Maynard A. Phibrook Jr. ');
  122. WriteLn('          1-203-456-2521  (1993)');
  123.  
  124. END.
  125.